Skip to content

Update FindESMF.cmake to make ESMF::ESMF main target#226

Merged
danrosen25 merged 3 commits into
esmf-org:developfrom
GMAO-SI-Team:update-cmake-target-namespace
Mar 15, 2024
Merged

Update FindESMF.cmake to make ESMF::ESMF main target#226
danrosen25 merged 3 commits into
esmf-org:developfrom
GMAO-SI-Team:update-cmake-target-namespace

Conversation

@mathomp4
Copy link
Copy Markdown
Contributor

@mathomp4 mathomp4 commented Feb 13, 2024

As detailed in #225, our UFS collaborators would like MAPL to provide a MAPL-targets.cmake file that uses ESMF::ESMF as the target within. From my testing, this can only seem to work if ESMF::ESMF is the main target provided by FindESMF.cmake and not an ALIAS.

So this PR does that, it essentially makes ESMF::ESMF the target the "main" add_library() call is run on and then makes ESMF the alias.

As far as I can tell, this works. All other needed changes are in GEOS and MAPL.

@mathomp4 mathomp4 marked this pull request as ready for review February 13, 2024 17:36
@danrosen25 danrosen25 self-assigned this Feb 28, 2024
@danrosen25 danrosen25 added the who: NASA Originates from NASA label Feb 28, 2024
@danrosen25 danrosen25 linked an issue Feb 28, 2024 that may be closed by this pull request
@danrosen25
Copy link
Copy Markdown
Member

Change requested broke the UFS build

ld: cannot find -lesmf
make[5]: *** [sorc/sfc_climo_gen.fd/CMakeFiles/sfc_climo_gen.dir/build.make:101: sorc/sfc_climo_gen.fd/sfc_climo_gen] Error 1
make[4]: *** [CMakeFiles/Makefile2:1401: sorc/sfc_climo_gen.fd/CMakeFiles/sfc_climo_gen.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....

@mathomp4
Copy link
Copy Markdown
Contributor Author

Change requested broke the UFS build

ld: cannot find -lesmf
make[5]: *** [sorc/sfc_climo_gen.fd/CMakeFiles/sfc_climo_gen.dir/build.make:101: sorc/sfc_climo_gen.fd/sfc_climo_gen] Error 1
make[4]: *** [CMakeFiles/Makefile2:1401: sorc/sfc_climo_gen.fd/CMakeFiles/sfc_climo_gen.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....

Well, huh. We might need to ask @AlexanderRichert-NOAA for some advice and help...

@danrosen25
Copy link
Copy Markdown
Member

I'm testing some more scenarios. Not every FindESMF.cmake file within the ufs-weather-model was consistent. It's possible that I clobbered a FindESMF.cmake file that was customized for a component. I would like to figure this out before making changes to the default library name of ESMF.

@mathomp4
Copy link
Copy Markdown
Contributor Author

I'm testing some more scenarios. Not every FindESMF.cmake file within the ufs-weather-model was consistent. It's possible that I clobbered a FindESMF.cmake file that was customized for a component. I would like to figure this out before making changes to the default library name of ESMF.

In GEOS one thing I've had to do (locally) is add aliases for esmf as well. But that was due to a long-ago choice local to us. Maybe UFS will need to move to ESMF::ESMF internally with this change? I am not sure.

I know from spack testing that if you build with spack, it doesn't seem to matter how many other FindESMF.cmake files I have around in GEOS, the one from the ESMF install wins!

@danrosen25
Copy link
Copy Markdown
Member

The issue is related to changing one of these three modules, which are already outdated.

I was able to build the ufs-weather-model with this newer version of the FindESMF module.

Copy link
Copy Markdown
Member

@danrosen25 danrosen25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please copy these changes to the following files:

  • src/addon/ESMX/Comps/ESMX_Data/cmake/FindESMF.cmake
  • src/addon/ESMX/Driver/cmake/FindESMF.cmake

@mathomp4
Copy link
Copy Markdown
Contributor Author

Please copy these changes to the following files:

  • src/addon/ESMX/Comps/ESMX_Data/cmake/FindESMF.cmake
  • src/addon/ESMX/Driver/cmake/FindESMF.cmake

This should be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

who: NASA Originates from NASA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change needed in FindESMF.cmake

2 participants